First, the access range of the private, public, and protected access labels.
PRIVATE: It can only be accessed by 1. functions in this class, 2. Other functions.
Cannot be accessed by any other user, nor can the object of this class be
Abstract: This article is a reflection on the previous post of bbs c/C ++. When I saw the post, I suddenly felt that I had timed out. It seems that I am getting unfamiliar here. This article attempts to discuss how the access control operator works,
In Java:
The access permissions in Java include public, private, protected, and default package access permissions. If the attribute methods in the class do not show the specified access permission, the package access permission is granted, I like
Php object-oriented access control: public, private, and protected. The article uses examples to illustrate the details of object-oriented access control Public, private, and protected in PHP5. if you need them, please refer to them. The
This section is translated from Apple's official documents by Cocoachina Translation team member jacefu (personal blog):The Swift programming language--language guide--access Control。 Proofreading: Childhoodandy (blog), please errata. Apple added a
This article uses the example to explain the PHP5 object-oriented access control public,private,protected detailed explanation, the need friend can refer to.
The object-oriented mechanism is enhanced in PHP5, and the access control mechanism of
In the swift language, there are three types of access modifiers, private,internal and public, respectively. At the same time, Swift's control of access rights is not class-based, butfile-based。 The difference is as follows:The properties or methods
1.mysql Package ClassDefine parameters for initializing database connections in a constructor "because the parameter passed in when instantiating an object is the only parameter entry for that object"But instead of redundant definitions in the
Access modifier: used to describe the access modifier where a member (attribute, method) can be accessed:
Used to describe where a member (attribute, method) can be accessed!
Tip:PHP adopts the concept of class to restrict access to members!PHP
First:Private, Public,protectedthe access scope of the access designator. Private: only by 1. Functions in this class,2. Its friend function access. The object of the class cannot be accessed by any other access. protected: can be 1. Functions in
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.